package com.gp.billsrecord.ui.main

import android.util.Log
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.fragment.findNavController
import androidx.navigation.ui.setupWithNavController
import com.gp.billsrecord.R
import com.gp.billsrecord.databinding.FragmentMainBinding
import com.gp.billsrecord.base.BaseFragment

/*首页*/
class MainFragment : BaseFragment<FragmentMainBinding>() {

    override fun onBindingCreated() {
        //记账悬浮按钮
        binding.btnMakeNote.setOnClickListener {
            //记账
            findNavController().navigate(R.id.makeNoteFragment)
        }
        val hostController =
            (childFragmentManager.findFragmentById(R.id.fragment_main_host) as NavHostFragment).navController

        Log.i(TAG, "onBindingCreated: $hostController")
        binding.navigationBottom.setupWithNavController(hostController)
    }
}